package yi.numberSeven;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class NumberSix {
    public static void main(String[] args) {
        List<Student> stuList = new ArrayList<>();
        stuList.add(new Student("迪丽热巴","女",18,99));
        stuList.add(new Student("古力娜扎","女",19,98));
        stuList.add(new Student("周杰伦","男",20,88));
        stuList.add(new Student("蔡徐坤","男",19,78));
        try(
                BufferedWriter bufferedWriter=new BufferedWriter(new FileWriter("g:/file/Task2.txt"))
                ) {
            for (Student student : stuList) {
                bufferedWriter.write(student.toString());
                bufferedWriter.newLine();
            }
        }catch (IOException e){
            e.printStackTrace();
        }

    }

}
